﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bxas.Core
{
    [Serializable]
    public class StandardProperties : IComparable<StandardProperties>
    {
        #region IsDirty
        private bool columnInfoIsDirty = false;
        [ColumnAttributes("IsDirty", false, "bool")]
        public bool IsDirty
        {
            get
            {
                return columnInfoIsDirty;
            }
            set
            {
                columnInfoIsDirty = value;
            }
        }
        #endregion

        #region IsFlaggedForDelete
        private bool columnInfoIsFlaggedForDelete = false;
        [ColumnAttributes("IsFlaggedForDelete", false, "bool")]
        public bool IsFlaggedForDelete
        {
            get
            {
                return columnInfoIsFlaggedForDelete;
            }
            set
            {
                if (value != columnInfoIsFlaggedForDelete)
                {
                    columnInfoIsFlaggedForDelete = value;
                    IsDirty = true;
                }
            }
        }
        #endregion

        #region Sort Order
        private int columnInfoSortOrder = 0;
        [ColumnAttributes("SortOrder", false, "int")]
        public int SortOrder
        {
            get
            {
                return columnInfoSortOrder;
            }
            set
            {
                if (value != columnInfoSortOrder)
                {
                    columnInfoSortOrder = value;
                    IsDirty = true;
                }
            }
        }
        #endregion

        #region Equals
        public bool Equals(StandardProperties comparedTo)
        {
            if (this.SortOrder == comparedTo.SortOrder)
            {
                return true;
            }
            return false;
        }
        #endregion

        #region Compare To
        public int CompareTo(StandardProperties comparedTo)
        {
            return this.SortOrder.CompareTo(comparedTo.SortOrder);
        }
        #endregion

        #region Compare To
        public int CompareTo(string thisItem, string comparedTo)
        {
            return String.Compare(thisItem, comparedTo);
        }
        #endregion
    }
}
